package com.ztools.pc.async;

import com.ztools.common.model.pc.sys.User;
import com.ztools.pc.service.sys.UserService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author:一口香菜
 * @Date: 2023/3/3  19:22
 * @Version 1.0
 */
@Async
@Component
public class SysAsync {

    @Resource
    private UserService userService;

    /**
     * 异步刷新用户最近登入时间
     *
     * @param user 对象
     */
    @Async
    public void doAfterUserLogin(User user) {
        user.setLoginTime(new Date());
        userService.update(user);
    }


}
